package com.javasm.util;

import java.util.UUID;

/**
 * @author WangJie
 * @version 1.0
 * @Description:
 * @date: 2020/7/20 20:34
 * @since JDK 1.8
 */
public class UUIDUtil {

    public static String renameUuid(String fileName){
        // 生成随机字符串
        String uuid = UUID.randomUUID().toString().replaceAll("-", "");
        // 获得文件后缀名称
        String suffixName = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
    // 生成最新的uuid文件名称
        String newFileName = uuid + "." + suffixName;
        return newFileName;
    }
}
